import gcoord from 'gcoord';
// 0 - lng  1 - lat
let util = {
	wgs84ToGcj102: (longitude, latitude) => {
		const result = gcoord.transform([longitude, latitude], gcoord.WGS84, gcoord.GCJ02)
		return result;
	},
	gcj102ToWgs84: (longitude, latitude) => {
		const result = gcoord.transform([longitude, latitude], gcoord.GCJ02, gcoord.WGS84)
		return result;
	},
	convertSecondsToTime:(seconds)=> {
		var days = Math.floor(seconds / (3600 * 24));
		var hours = Math.floor((seconds % (3600 * 24)) / 3600);
		var minutes = Math.floor(((seconds % (3600 * 24)) % 3600) / 60);
		var remainingSeconds = ((seconds % (3600 * 24)) % 3600) % 60;

		var timeString = "";
		if (days > 0) {
			timeString += days + "天";
		}
		if (hours > 0) {
			timeString += hours + "时";
		}
		if (minutes > 0) {
			timeString += minutes + "分";
		}
		if (remainingSeconds > 0) {
			timeString += remainingSeconds + "秒";
		}

		return timeString;
	}
}
export default util;